const app = getApp()
var id = ''//用户id
// var getdata = require('../../utils/getdata.js');
// var utils = require('../../utils/util.js');
Page({
  data: {
    films: [],
    hasMore: true,
    showLoading: true,
    start: 0
  },
  onLoad: function (res) {
    var that = this;
    wx.getStorage({
      key: 'userid',
      success: function (res) {
        that.setData({
          userid: res.data
        })
        //console.log(that.data.userid)
        //赋值
        id = that.data.userid
        console.log('========='+id)
      },
    })
    //获取用户信息
    wx.getUserInfo({
      success: function (re) {
        that.setData({
          nickName: re.userInfo.nickName,
          avatarUrl: re.userInfo.avatarUrl,
        })
        //console.log(re.userInfo.nickName);
      }
    })
    //获取用户答题情况
    wx.request({
      url: 'http://10.20.58.235:8080/v1/open/information/manager/ranking',
      header: {
        'Content-Type': 'application/xml',
      },
      success: function (res) {
        console.log(res);
        that.setData({
        list: res.data,
        section: false
        })
      }
    })

  },
    //分享按钮
    onShareAppMessage:function(res){
    if(res.from==='menu'){
      console.log(res.target)
    }
    return{
      title:'快来查看答题排行榜！'
    }
  },
  //跳转
  jump:function(){
    wx.navigateTo({
      url: 'no_details/no_details',
    })
  },
})
